<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Document</title>
    <style>
        html,
        body,
        #app {
            width: 100%;
            height: 100%;

        }

        #app {
            min-width: 1200px;
        }

        html {
            font-size: 10px;
        }

        div {
            font-size: 1.5rem;
        }
    </style>
</head>

<body>
    <div id="app"></div>
</body>
<script>
    var c = () => {
        let w = document.documentElement.clientWidth;//获取设备的宽度
        let n = (10 * (w / 1280) > 40 ? 40 + 'px' : 10 * (w / 1280) + 'px');
        document.documentElement.style.fontSize = n;
    }
    window.addEventListener("load", c);
    window.addEventListener("resize", c);
</script>

</html>